<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<title>登录界面</title>
	<link href="css/login/default.css" rel="stylesheet" type="text/css" />
	<!--必要样式-->
	<link href="css/login/styles.css" rel="stylesheet" type="text/css" />
	<link href="css/login/demo.css" rel="stylesheet" type="text/css" />
	<link href="css/login/loaders.css" rel="stylesheet" type="text/css" />
	<link href="css/login/login.css" rel="stylesheet" type="text/css" />
	<link href="css/login/Icon.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class='user-login'>
	<div class="header-login">
		<img src="/img/login/logo-ava1.png" alt="">
		<span></span>
		<p>智慧汽车门店管理系统</p>
	</div>
	<div class="header-content">

		<ul>
			<li>
				<p>用户名</p>
				<div class="login-list">
					<em class="iconfont" style="color:#000;text-align: center;line-height: 50px;font-size:16px;">&#xe801;</em>
					<input type="text" placeholder="请输入你的账号" name="login" maxlength="16" autocomplete="off" value=""id="login">
				</div>
			</li>
			<li>
				<p>密码</p>
				<div class="login-list">
					<em class="iconfont" style="color:#000;text-align: center;line-height: 50px;font-size:16px;">&#xe756;</em>
					<input type="password" placeholder="请输入你的密码" name="pwd" maxlength="16" autocomplete="off" value="" id="psd">
				</div>
			</li>
			<!--<li>-->
				<!--<p>验证码</p>-->
				<!--<div class="login-list y-login">-->
					<!--<em></em> <input type="text" placeholder="请输入验证码">-->
				<!--</div>-->
				<!--<div class="y-msg"></div>-->
			<!--</li>-->
		</ul>
		<div class="re-psd">
			<div class="left">
				<input type="checkbox" name="rememberMe" id="rememberMe">
				<p class="item">记住密码</p>
			</div>
			<!--<a href="/forgetPwd">
				<div class="right">
					忘记密码？
				</div>
			</a>-->
		</div>
		<div class="submit" id="submit">登 录</div>
		<!--<div class="Toregistered">还没注册?<a href="/register" style="color:#5785db;">免费注册>></a></div>-->
	</div>
	<div class="footer">2016 © 深圳前海壹互联投资有限公司 LGPL license</div>
</div>
<link href="plugins/layui/css/layui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script type="text/javascript" src="js/login/jquery.min.js"></script>
<script type="text/javascript" src="js/login/jquery-ui.min.js"></script>
<script type="text/javascript" src='js/login/stopExecutionOnTimeout.js?t=1'></script>

<script type="text/javascript" src="js/login/Particleground.js"></script>
<script type="text/javascript" src="js/login/Treatment.js"></script>
<script type="text/javascript" src="js/login/jquery.mockjax.js"></script>
<script type="text/javascript">
    var canGetCookie = 0;//是否支持存储Cookie 0 不支持 1 支持
    var ajaxmockjax = 1;//是否启用虚拟Ajax的请求响 0 不启用  1 启用
    //默认账号密码

//    var truelogin = "123456";
//    var truepwd = "123456";
//    var CodeVal = 0;


//   $("#submit").click(()=>{
//       	let login = $("#login").val();
//		let psd = $("#psd").val();
//		let rememberMe;
//		if($('#rememberMe').is(':checked')) {
//			rememberMe = true
//		}else{
//            rememberMe =false;
//		}
//   })
	/**
	 * 监听回车键
	 * **/
    $(document).keypress(function (e) {
        // 回车键事件
        if (e.which == 13) {
            $('#submit').click();
        }
    });
    var fullscreen = function () {
        elem = document.body;
        if (elem.webkitRequestFullScreen) {
            elem.webkitRequestFullScreen();
        } else if (elem.mozRequestFullScreen) {
            elem.mozRequestFullScreen();
        } else if (elem.requestFullScreen) {
            elem.requestFullscreen();
        } else {
            //浏览器不支持全屏API或已被禁用
        }
    }
    layui.use('layer', function () {
        //非空验证
        $('#submit').click(function(){
            var login = $('#login').val();
            var pwd = $('#psd').val();

            var rememberMe=$('#rememberMe').is(':checked');

            if (login == '') {
                ErroAlert('请输入您的账号');
            } else if (pwd == '') {
                ErroAlert('请输入密码');
            } else {
                //登录
                var JsonData = { username: login, password: pwd,rememberMe:rememberMe};
                var	url = "/users/login";
                //此处做为ajax内部判断
                AjaxPost(url, JsonData,
                    function () {
                        //ajax加载中
                    },
                    function (data) {
                        //ajax返回
                        if (data.code==2000) {
                            //登录成功
                            $('.login div').fadeOut(100);
                            $('.success').fadeIn(1000);
                            $('.success').html(data.Text);
                            //跳转操作
                            localStorage.setItem("isAdmin",data.data);
                            window.location.href='/index';

                        } else {
                            AjaxErro(data);
                        }
                    })
            }
        })
    })
    if(ajaxmockjax == 1){
        $.mockjax({
            url: 'Ajax/Login',
            status: 200,
            responseTime: 50,
            responseText: {"Status":"ok","Text":"登录成功<br /><br />欢迎回来"}
        });
        $.mockjax({
            url: 'Ajax/LoginFalse',
            code: 500,
            responseTime: 50,
            responseText: {"code":"500","msg":"验证码有误"}
        });
    }
</script>

</body>
</html>
